package com.hengshan.domain.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hengshan.common.annotation.ExcelDictFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 系统访问记录(SysLoginLog)表实体类
 *
 * @author muxijun
 * @since 2024-01-22 18:12:28
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("sys_login_log")
public class SysLoginLog implements Serializable {

    //访问ID
    @ExcelIgnore
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    //用户账号
    @ExcelProperty(value = "用户账号")
    private String username;

    //登录IP地址
    @ExcelProperty(value = "登录IP")
    private String ip;

    //登录地点
    @ExcelProperty(value = "登录地点")
    private String location;

    //浏览器类型
    @ExcelProperty(value = "浏览器")
    private String browser;

    //操作系统
    @ExcelProperty(value = "操作系统")
    private String os;

    //登录状态（0成功 1失败）
    @ExcelProperty(value = "登录状态")
    @ExcelDictFormat(converterExp = "0=成功,1=失败", separator = ",")
    private String status;

    //提示消息
    @ExcelProperty(value = "提示消息")
    private String message;

    //访问时间
    @ExcelProperty(value = "访问时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    //请求参数
    @TableField(exist = false)
    private Map<String, Object> params = new HashMap<>();
}

